package com.jiazhong.mingxing.boot.boot05.test;

import com.jiazhong.mingxing.boot.boot05.bean.Student;
import com.jiazhong.mingxing.boot.boot05.service.StudentService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.List;

@SpringBootTest
@Slf4j
public class App {
    @Resource
    private StudentService studentService;

    @Test
    public void a() {
        Student student = studentService.findStudentById("1967064838758047746");
        log.info("student:{}", student);
    }

    @Test
    public void b1() {
        List<Student> all = studentService.findAll1();
        log.info("all:{}", all);
    }

    @Test
    public void b2() {
        List<Student> all = studentService.findAll2();
        all.forEach(e -> {
            log.info("e:{}", e);
        });
    }

    @Test
    public void b3() {
        List<Student> all = studentService.findAll3();
        all.forEach(e -> {
            log.info("e:{}", e);
        });
    }

    @Test
    public void c() {
        Student student = new Student();
        student.setName("许锦阳");
        student.setPlaceOfOrigin("陕西宝鸡");
        student.setCourseId(1965250815853547521L);
        student.setSchoolId(1965321181514842113L);
        student.setBirthday("2003-4-19");
        student.setStuNo("JK202509283764");
        student.setGender('男');
        int row = studentService.saveStudent(student);
        log.info("row:{}", row);
    }

    @Test
    public void d() {
        Student student = new Student();
        student.setId(1967037245295960065L);
        student.setBirthday("2003-3-11");
        int row = studentService.updateStudent(student);
        log.info("row:{}", row);
    }
    @Test
    public void e(){
        studentService.removeStudentById("1967037245295960065");
    }
}
/*
每个人在10月10日之前，提交MySQL和Redis同步问题文档，作业形式为markdown。提交到钉钉群，名称为：XXX.md，例如熊小熊.md文件。
1. 为什么要使用redis缓存mysql中的数据？
2. 什么是数据同步问题？
3. 我们如何设计数据同步结构？
4. 书写过程中出现过什么问题？可写可不写
 */